package com.cqut.forum.entity;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * @author yangxun
 * Review entity
 */
@Entity
@Table(name = "review", catalog = "forum")
public class Review implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer reviewId;
	private Picture picture;
	private Integer reviewUserId;
	private String reviewContents;
	private Boolean isPublic;
	private Date reviewTime;
	//private Integer aboveReviewId;
	private Boolean reviewState;
	// Constructors

	/** default constructor */
	public Review() {
	}

	/** full constructor */
	public Review(Picture picture, Integer reviewUserId, String reviewContents,
			Boolean isPublic, Date reviewTime, /*Integer aboveReviewId,*/ Boolean reviewState) {
		this.picture = picture;
		this.reviewUserId = reviewUserId;
		this.reviewContents = reviewContents;
		this.isPublic = isPublic;
		this.reviewTime = reviewTime;
		//this.aboveReviewId = aboveReviewId;
		this.reviewState = reviewState;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "review_id", unique = true, nullable = false)
	public Integer getReviewId() {
		return this.reviewId;
	}

	public void setReviewId(Integer reviewId) {
		this.reviewId = reviewId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "picture_id")
	public Picture getPicture() {
		return this.picture;
	}

	public void setPicture(Picture picture) {
		this.picture = picture;
	}

	@Column(name = "review_user_id")
	public Integer getReviewUserId() {
		return this.reviewUserId;
	}

	public void setReviewUserId(Integer reviewUserId) {
		this.reviewUserId = reviewUserId;
	}

	@Column(name = "review_contents", length = 200)
	public String getReviewContents() {
		return this.reviewContents;
	}

	public void setReviewContents(String reviewContents) {
		this.reviewContents = reviewContents;
	}

	@Column(name = "is_public")
	public Boolean getIsPublic() {
		return this.isPublic;
	}

	public void setIsPublic(Boolean isPublic) {
		this.isPublic = isPublic;
	}

	@Column(name = "review_time", length = 10)
	public Date getReviewTime() {
		return this.reviewTime;
	}

	public void setReviewTime(Date reviewTime) {
		this.reviewTime = reviewTime;
	}

	/*@Column(name = "above_review_id")
	public Integer getAboveReviewId() {
		return this.aboveReviewId;
	}

	public void setAboveReviewId(Integer aboveReviewId) {
		this.aboveReviewId = aboveReviewId;
	}*/
	@Column(name = "review_state")
	public Boolean getReviewState() {
		return reviewState;
	}

	public void setReviewState(Boolean reviewState) {
		this.reviewState = reviewState;
	}
}